package cn.com.open.itembank.logic.importfilereader;

/**
 * Created by lucky on 2017/12/15.
 */
public class FileReaderFactory {

    private FileReaderFactory() {
    }

    /**
     * Get instance file reader.
     *
     * @param fileExtension  the file extension
     * @param appKey         the app key
     * @param appSecret      the app secret
     * @param resourceApiUrl the resource api url
     * @param imageSaveType  the image save type
     * @return the file reader
     */
    public static FileReader getInstance(String fileExtension, String appKey, String appSecret, String resourceApiUrl, int imageSaveType) {
        FileReader fileReader = null;

        if (".docx".equalsIgnoreCase(fileExtension) || ".doc".equalsIgnoreCase(fileExtension)) {
            fileReader = new WordFileReader(appKey, appSecret, resourceApiUrl, imageSaveType);
        } else if (".xls".equalsIgnoreCase(fileExtension) || ".xlsx".equalsIgnoreCase(fileExtension)) {
            fileReader = new ExcelFileReader();
        }

        return fileReader;
    }

}
